﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyMes.Dto;
using MyMES.Dto;
using MyMES.IServices.ToolingFixtureLedger;
using System.Linq;
using System.Threading.Tasks;
using VOL.Core.Utilities.Response;
using VOL.Entity.DomainModels;
using VOL.Entity.DomainModels.Core;
using VOL.Entity.DomainModels.Repository;

namespace VOL.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ToolingFixtureLedgerServiceController : ControllerBase
    {
        private readonly IToolingFixtureLedgerService _toolingFixtureLedgerService;

        public ToolingFixtureLedgerServiceController(IToolingFixtureLedgerService toolingFixtureLedgerService)
        {
            _toolingFixtureLedgerService = toolingFixtureLedgerService;
        }
        /// <summary>
        /// 新增工装夹具台账
        /// </summary>
        /// <param name="toolingFixtureLedger">工装夹具台账实体</param>
        /// <returns>操作结果</returns>
        [HttpPost("AddToolingFixtureLedger")]
        public async Task<ActionResult<WebResponseContent>> Add([FromBody] toolingfixtureledger toolingFixtureLedger)
        {
            return await _toolingFixtureLedgerService.AddToolingfixtureledgerModel(toolingFixtureLedger);
        }
        /// <summary>
        /// 修改工装夹具台账
        /// </summary>
        /// <param name="toolingFixtureLedger">工装夹具台账实体</param>
        /// <returns>操作结果</returns>
        [HttpPost("UpdateToolingFixtureLedger")]
        public async Task<ActionResult<WebResponseContent>> Update([FromBody] toolingfixtureledger toolingFixtureLedger)
        {
            return await _toolingFixtureLedgerService.UpdateToolingfixtureledgerModel(toolingFixtureLedger);
        }
        /// <summary>
        /// 修改工装夹具台账
        /// </summary>
        /// <param name="toolingFixtureLedger">工装夹具台账实体</param>
        /// <returns>操作结果</returns>
        [HttpPost("DeleteToolingFixtureLedger")]
        public async Task<ActionResult<WebResponseContent>> Delete([FromBody] toolingfixtureledger toolingFixtureLedger)
        {
            return await _toolingFixtureLedgerService.DelToolingfixtureledgerModel(toolingFixtureLedger);
        }
        [HttpGet("GetToolingfixtureledgers")]
        public async Task<PageGridData<toolingfixtureledger>> GetList([FromQuery]string? code, string? name, string? type, int? isStatus, int pageIndex = 1, int pageSize = 5)
        {
            return await _toolingFixtureLedgerService.GetToolingfixtureledgers(code, name, type,isStatus, pageIndex, pageSize);
        }
    }
}
